package com.miaosha.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.miaosha.entity.Goods;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;


@Mapper
public interface GoodsMapper extends BaseMapper<Goods> {

    /**
     * 根据id查找用户
     *
     * @param id
     * @return
     */
    Goods findById(Integer id);


    /**
     * 减秒杀商品的数量-1
     *
     * @param id
     * @return
     */
    int reduceStock(Integer id);

    List<Goods> listByName(@Param("name") String name, Long userId);
}